package cc.io24.knewcafe.boss.controller;

import cc.io24.knewcafe.boss.domain.SysRole;
import cc.io24.knewcafe.boss.service.SysRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/SysRole")
public class SysRoleController extends BaseController<SysRole> {

    @Autowired
    public void setSysRoleService(SysRoleService sysRoleService) {
        super.setService(sysRoleService);
    }

//    private SysRoleService sysRoleService;
//
//    @GetMapping(value = "",produces="application/json")
//    public List<SysRole> getList(@ModelAttribute SysRole sysRole,
//                                 @PageableDefault(value = 10, sort = { "createDate" }, direction = Sort.Direction.DESC)Pageable pageable,
//                                 HttpServletResponse response){
//        Page<SysRole> page =  sysRoleService.getList(sysRole,pageable);
//        response.addHeader("X-Total-Count",page.getTotalElements()+"");
//        response.addHeader("Access-Control-Expose-Headers","X-Total-Count");
//        return page.getContent();
//    }
//
//    @GetMapping(value = "/{id}",produces="application/json")
//    public SysRole getOne(@PathVariable("id")String id,
//                                   HttpServletResponse response){
//        SysRole sysRole =  sysRoleService.getOne(id);
//        return sysRole;
//    }
//
//
//    @PostMapping(value = "",produces="application/json")
//    public SysRole create(@RequestBody SysRole sysRole,
//                          HttpServletResponse response){
//        return sysRoleService.insert(sysRole);
//    }
//
//    @PutMapping(value = "/{id}",produces="application/json")
//    public SysRole update(@PathVariable("id")String id,
//                          @RequestBody SysRole sysRole,
//                          HttpServletResponse response){
//        sysRole.setId(id);
//        return sysRoleService.update(sysRole);
//    }
//
//    @DeleteMapping(value = "/{id}",produces="application/json")
//    public void delete(@PathVariable("id")String id,
//                          HttpServletResponse response){
//        sysRoleService.deleteById(id);
//    }

}
